CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#主版本号
SET(TEST_MAJOR "1" CACHE STRING "The major version")
#次版本号
SET(TEST_MINOR "0" CACHE STRING "The minor version")
#设置cfg.h配置文件
CONFIGURE_FILE(${CMAKE_HOME_DIRECTORY}/cfg.h.in ${CMAKE_HOME_DIRECTORY}/cfg.h @ONLY)

PROJECT(c-test)
#FIND_PACKAGE(OpenSSL REQUIRED)
#cmake居然不支持SQLite3库的查找
#FIND_PACKAGE(SQLite3 REQUIRED)
SET(CMAKE_C_FLAGS "-fPIC")
IF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
  OPTION(TEST_DEBUG "iserver into debug mode" ON)
  SET(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}")
ELSE()
  UNSET(TEST_DEBUG CACHE)
  SET(CMAKE_C_FLAGS "-O2 ${CMAKE_C_FLAGS}")
ENDIF()
INCLUDE_DIRECTORIES(.)
ADD_SUBDIRECTORY(gdb)
#ADD_EXECUTABLE(${PROJECT_NAME} ${MAIN_SRC_LIST} ${INDEV_SRC_LIST} ${INT_SRC_LIST})
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} incore iscore ismode pthread ssl crypto curl websockets sqlite3)
#INSTALL(TARGETS ${PROJECT_NAME}
#    RUNTIME DESTINATION bin
#    LIBRARY DESTINATION lib
#    ARCHIVE DESTINATION lib
#    )
#cpack
SET(CPACK_GENERATOR "DEB")
SET(CPACK_SYSTEM_NAME "ubuntu-armhf")
SET(CPACK_PACKAGE_NAME "c-test")
#关于安装包版本说明IN_VERSION.IS_MAJOR.IS_MINOR
SET(CPACK_PACKAGE_VERSION_MAJOR ${TEST_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${TEST_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Lugg")
SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
INCLUDE(CPack)
